<#assign base=request.contextPath />
<!DOCTYPE html>
<html>
<head>
  <base href="${base}">	
  <meta charset="utf-8">
  <title>更改密码</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="${base}/layuiadmin/layui/css/layui.css" media="all">
</head>

<body>
  	<div class="layui-form" lay-filter="LAY-form-list" style="padding: 20px 30px 0 0;">
  		<input type="hidden" name="userId" value="${(userId)!}">
    	<div class="layui-form-item">
      		<label class="layui-form-label">新密码</label>
      		<div class="layui-input-inline">
        		<input type="text" name="newpassword"  lay-verify="required" placeholder="请输入新密码" autocomplete="off" class="layui-input">
      		</div>
    	</div>   
    	<div class="layui-form-item">
      		<label class="layui-form-label">确认密码</label>
      		<div class="layui-input-inline">
        		<input type="text" name="password"  lay-verify="required" placeholder="请确认输入密码" autocomplete="off" class="layui-input">
      		</div>
    	</div>       
	    <div class="layui-form-item layui-hide">
	      	<input type="button" lay-submit lay-filter="LAY-form-submit" id="LAY-form-submit" value="确认添加">
	      	<input type="button" lay-submit lay-filter="LAY-form-edit" id="LAY-form-edit" value="确认编辑">
	    </div>
  	</div>

  <script src="${base}/layuiadmin/layui/layui.js"></script>  
  <script>
  	layui.config({
    	base: '${base}/layuiadmin/' //静态资源所在路径
  	}).extend({
    	index: 'lib/index',
    	jwt: '{/}${base}/js/lib/jwt'
  	}).use(['index', 'form', 'jwt'], function(){
    	var $ = layui.$,
    		form = layui.form,
    		jwt = layui.jwt;
    
    	//监听提交
    	form.on('submit(LAY-form-submit)', function(data) {
      		var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引  
      		//提交ajax成功后，关闭当前弹层并重载表格
      		jwt.ajax({
      			url: '${base}/system/user/savePwd',
      			data: data.field,
      			success: function(json) {
      				if(!json.success){
      					layer.msg(json.msg);
      				}else{
      					layer.msg("更改密码成功");
      					parent.layui.table.reload('LAY-table'); 
      					parent.layer.close(index);
      				}
      			}
      		});
      		
    	});
  	})
  </script>
</body>
</html>